package cn.topevery.garden.dal.logic;

import cn.topevery.garden.dal.dao.CommunityDao;
import cn.topevery.garden.entity.po.Community;
import cn.topevery.garden.entity.query.CommunityQuery;
import cn.topevery.garden.entity.vo.CommunityVO;
import cn.topevery.garden.framework.base.BaseLogic;
import hw.topevery.framework.db.base.BaseEntityDao;
import hw.topevery.framework.db.entity.DataPager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 群落表
 *
 * @author code-generate
 * @date 2022-01-05
 */
@Service
public class CommunityLogic extends BaseLogic<Community> {
    @Autowired
    CommunityDao communityDao;

    @Override
    public BaseEntityDao<Community, Integer> getDao() {
        return communityDao;
    }

    

    /**
     * 获取列表
     *
     * @param query
     */
    public DataPager<CommunityVO> listPage(CommunityQuery query) {
        return communityDao.listPage(query);
    }

    /**
     * 根据自增id批量删除
     *
     * @param ids
     */
    public void deleteBatchById(String userId,Integer[] ids) {
        communityDao.delete(userId, ids);
    }

    /**
     * 根据自增id保存或者更新
     *
     * @param community 实体
     */
    public void saveOrUpdate(String userId, Community community){
        communityDao.saveOrUpdate(userId,community);
    }

    /**
         * 根据自定义列值来获取对象
         */
    public Community getEntityByColumn(String key, String value) {
        return communityDao.getEntityByColumn(key, value);
    }

    public List<Community> getList(){
        return communityDao.getList();
    }

    public List<Map<String,Object>> listMaps() {
        return communityDao.listMaps();
    }


}
